<?php

require './library/db_constants.php';
require './library/planets.php';

// Call planets class for the createPlanet function.
$planets = new planets;

if(isset($_POST['create'])) {
    $planets->createPlanet($_POST['planet_name'], $_POST['planet_size']);
}

?>
<!DOCTYPE html>
<html>
    <head>
        <title>SWC Prospecting Manager || Create Planet</title>
    </head>
    <body>
        <h1>Create Planet</h1>
        <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
            <div id="planetForm">
                <fieldset>
                    <legend>Create Planet</legend>
                        <label for="planet_name">Planet Name: </label>
                        <input type="text"  size="30" maxlength="80" 
                               name="planet_name" placeholder="Planet Name" id="planet_name"/>
                        <br />
                        <label for="planet_size">Planet Size: </label>
                        <select name="planet_size" id="planet_size">
                            <option value="---" selected>---</option>
                            <option value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                            <option value="11">11</option>
                            <option value="12">12</option>
                            <option value="13">13</option>
                            <option value="14">14</option>
                            <option value="15">15</option>
                            <option value="16">16</option>
                            <option value="17">17</option>
                            <option value="18">18</option>
                            <option value="19">19</option>
                            <option value="20">20</option>
                            <option value="21">21</option>
                            <option value="22">22</option>
                            <option value="23">23</option>
                            <option value="24">24</option>
                            <option value="25">25</option>
                            <option value="26">26</option>
                            <option value="27">27</option>
                            <option value="28">28</option>
                            <option value="29">29</option>
                            <option value="30">30</option>
                        </select>
                        <br />
                        <input type="submit" value="Create" name="create"
                               id="create" />
                        <input type="reset" value="Reset" id="reset" />
                        
                </fieldset>
            </div>
        </form>
            <footer>
                <a href="index.php">Home</a> || <a href="listPlanets.php">List/Edit Planets</a> ||
                <a href="createDeposit.php">Create Deposit</a> || <a href="listDeposits.php">List/Edit Deposits</a>
            </footer>
        
    </body>
</html>